import request from "@/utils/request"

// 获取二维码 key
export const getQRKey = () => {
  return request({
    method: 'GET',
    url: `/login/qr/key?timerstamp=${Date.now()}`
  })
}

// 二维码生成接口
export const createQR = data => {
  return request({
    method: 'POST',
    url: `/login/qr/create?key=${data}&qrimg=true&timerstamp=${Date.now()}`
  })
}

// 检查扫码状态
export const checkQRStatus = data => {
  return request({
    method: 'GET',
    url: `/login/qr/check?key=${data}&timerstamp=${Date.now()}&noCookie=true`
  })
}

// 获取登录状态
export const loginStatus = data => {
  return request({
    method: 'GET',
    url: `/login/status`,
    params: {
      cookie: data
    }
  })
}

// 获取验证码
export const getCodeApi = (phone) => {
  return request({
    url: '/captcha/sent',
    params: {
      phone
    }
  })
}

// 注册网易云账号
export const registerAccountApi = (params) => {
  return request({
    url: '/register/cellphone',
    params
  })
}

// 检查手机号是否注册
export const checkPhoneRegisterApi = (params) => {
  return request({
    url: '/cellphone/existence/check',
    params
  })
}